#include "FileHelper.h"
#include <Shlobj.h>
#include <WinDef.h>
#include <stdio.h>

char *FileHelper::GetMyDocs()
{
	static char szPath[MAX_PATH];
	SHGetFolderPath(GetActiveWindow(), CSIDL_MYDOCUMENTS, NULL, 0, szPath);
	return szPath;
}

char *FileHelper::GetAppData()
{
	static char szPath[MAX_PATH];
	SHGetFolderPath(GetActiveWindow(), CSIDL_APPDATA, NULL, 0, szPath);
	return szPath;
}

char *FileHelper::GetLocalMinecraftData()
{
	static char szPath[MAX_PATH];
	SHGetFolderPath(GetActiveWindow(), CSIDL_APPDATA, NULL, 0, szPath);
	strcpy_s(szPath + strlen(szPath), MAX_PATH - strlen(szPath), "\\.minecraft");
	return szPath;
}

char *FileHelper::GetFullPathToMinecraftData(const char *szFile)
{
	static char buff[MAX_PATH];
	sprintf_s(buff, MAX_PATH, "%s\\%s", GetLocalMinecraftData(), szFile);
	return buff;
}
